package Entity;

import java.awt.List;
import java.io.Serializable;
import java.util.ArrayList;

/** this class Create new Instance of customer card*/
public class CustomerCard implements Serializable {
private static final long serialVersionUID = 42L;
	
	/**attributes for customerCard*/
	public String SaleID;	
	public String CustomerID;
	public String ProductName;
	public boolean ContactCust;
	public String CustResponse;
	public boolean CustApproval;
	public int CallTime;
	static String [] CustomersStringArr={""};
	static List customers;
	public ArrayList<CustomerCard> customersCardList;
	
	
	/**Full constructor with all attributes*/
	public CustomerCard(String SaleID, String CustomerID,  int ContactCust, String ProductName,  String CustResponse,int CustApproval, int CallTime )
	{
		setCSaleID(SaleID);
		setCCustomerID(CustomerID);
		setCProductName(ProductName);
		setCContactCust((ContactCust));
		setCustResponse(CustResponse);	
		setCustApproval(CustApproval);
		setCallTime(CallTime);
		customersCardList = new ArrayList<CustomerCard>();
	}
	
	/**default constructor*/
	public CustomerCard() 
	{
		
	}
	
	/**constructor for customers*/
	public void Customers()
	{
		createCustomerList();
	}
	
	/**get functions*/
	public static String[] getCustomersStringArr() 
	{
		return CustomersStringArr;
	}
	
	public static List getCustomers() 
	{
		return customers;
	}
	
	public String getCSaleID()
	{
		return this.SaleID;
	}
	
	public String getCCustomerID()
	{
		return this.CustomerID;
	}
	
	public String getCProductName()
	{
		return ProductName;
	}
	
	public int getCContactCust()
	{
		if (ContactCust) return 1;
		else return 0;
	}
	
	public String getCustResponse()
	{
		return CustResponse;
	}
	
	public int getCallTime()
	{
		return CallTime ;
	}
	
	public int getCustApproval()
	{
		if (CustApproval) return 1;
		else return 0;
		
	}
	
	/** set functions */
	public void setCSaleID(String SaleID)
	{
		this.SaleID=SaleID;
	}
	
	public void setCCustomerID(String CustomerID)
	{
		this.CustomerID=CustomerID;
	}
	
	public void setCProductName(String ProductName)
	{
		this.ProductName=ProductName;
	}
	
	public void setCContactCust(int val)
	{
		if (val==0)
			this.ContactCust=false;
		else if (val==1)
			this.ContactCust=true;
	}
	
	public void setCustResponse(String CustResponse)
	{
		this.CustResponse=CustResponse;
	}
	
	public void setCallTime(int callTime2)
	{
		this.CallTime=callTime2;
	}
	
	public void setCustApproval(int val)
	{
		if (val==0)
			this.CustApproval=false;
		else if (val==1)
			this.CustApproval=true;

	}
	
	public static void setCustomers(List customers) 
	{
		CustomerCard.customers = customers;
	}
	
	public static void setCustomers(String[] CustomersStringArr) 
	{
		CustomerCard.CustomersStringArr = CustomersStringArr;
		customers =  new List();
		for(int i=0;i<CustomersStringArr.length;i++)
			customers.add(CustomersStringArr[i]);
	}
	
	public void setCustomersList (List customers) 
	{
		CustomerCard.customers = customers;
	}
	
	/**function which creates new custommer list*/
	private void createCustomerList() 
	{
		customers = new List();
		customers.add("choose customer");
	}
	
	/**function which add customer into array*/
	public static void addCustomer(String customer)
	{
		String tmp[] = new String[CustomersStringArr.length+1];
		for(int i=0;i<tmp.length-1;i++)
		{
			tmp[i]=new String(CustomersStringArr[i]);
		}
		tmp[tmp.length-1] = customer;
		customers.add(customer);
	}
}
